<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />

		<script src="js/marked.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/markdown.css" />

		<title>Develop Around | IceDog</title>
	</head>

	<body>

		<body>
			<div id="content">
			如果看到此消息，说明是通过文件直接访问，请运行server脚本通过http协议打开
			</div>
			<script type="text/javascript">
				const get = (url) => new Promise((resolve, reject) => {
					let xhr = new XMLHttpRequest();
					xhr.open('GET', url, true);
					xhr.setRequestHeader('Content-Type', 'application/json');
					xhr.send();
					xhr.onload = () => resolve(xhr.responseText);
					xhr.onerror = error => reject(error);
				});
				var content = document.querySelector('#content');
				var path = "";
				const refresh = () => {
					var hash = window.location.hash;
					if(hash.length !== 0) {
						path = 'doc-data/' + hash.slice(1);
					} else {
						path = "index";
					}
					get(path + '.md')
					.then(data => content.innerHTML = marked(data))
					.then(() => {
						[].slice.call(document.getElementsByTagName('a'), 0).forEach(item => item.setAttribute('target', '_blank'));
					});
				};
				window.addEventListener('load', refresh, false);
				window.addEventListener('hashchange', refresh, false);
			</script>
		</body>
	</body>

</html>